<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
   xmlns:f="http://xmlns.jcp.org/jsf/core"
   xmlns:h="http://xmlns.jcp.org/jsf/html"
   xmlns:p="http://primefaces.org/ui"
   xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
   template="/WEB-INF/templates/default.xhtml">
   
   	<f:metadata>
	   	<f:viewParam name="parentSectorId" value="#{parentSectorHome.id}" />
	   	<f:viewParam name="sectorId" value="#{sectorHome.id}"></f:viewParam>
	   	<f:event listener="#{sectorHome.initConversation()}" type="preRenderView"></f:event>
	   	<f:viewParam name="moduleName" value="行业管理"></f:viewParam>
   	</f:metadata>
   <ui:define name="head">
   		<style type="text/css">
   			.ui-selectonemenu-panel .ui-selectonemenu-filter-container .ui-icon {
			    position: absolute;
			    top: 12px;
			    right: 15px;
			}
   		
   		</style>
   </ui:define>
   	<ui:define name="content">
   
		<h:form id="editForm">         
			<p:panel id="panel" header="#{sectorHome.managed ? '修改' : '新增'}行业" style="margin-bottom:10px;">
		       <p:messages id="messages" closable="true"><p:autoUpdate/></p:messages>
		        
		        <h:panelGrid columns="2" cellpadding="5">
					<p:outputLabel for="sectorName" value="行业名称" />				
					<p:inputText id="sectorName" 
							  value="#{sectorHome.instance.sectorName}"
						   required="true" />
						   
					<p:outputLabel for="parentSector" value="所属行业类型"></p:outputLabel>
					<p:selectOneMenu id="parentSector" filter="true"
								  value="#{parentSectorHome.instance}" style="width: 200px">
						<f:selectItem itemLabel="无" itemValue="#{null}" />
						<f:selectItems value="#{sectorHome.getAllSectorList()}" var="_sector" itemLabel="#{_sector.levelSectorName}" itemValue="#{_sector}"></f:selectItems>
						<f:converter converterId="entityConverter"></f:converter>						
					</p:selectOneMenu>
				</h:panelGrid>
			</p:panel>
			
			<p:commandButton action="#{sectorHome.saveAndFlush()}" value="保存" ajax="false" />
			<p:commandButton value="删除" action="#{sectorHome.delete()}">
				<p:confirm header="请确认" message="您确认删除记录吗?" icon="ui-icon-alert" />
			</p:commandButton>
			<p:commandButton action="#{sectorHome.cancel()}" value="取消" immediate="true"></p:commandButton>	
						
			<p:confirmDialog id="confirmDialog" global="true" showEffect="fade" hideEffect="explode" widgetVar="confirmDialog">
			    <p:commandButton value="确认" styleClass="ui-confirmdialog-yes"></p:commandButton>
			    <p:commandButton value="取消" immediate="true" styleClass="ui-confirmdialog-no" />
			</p:confirmDialog>
		</h:form>
      
   	</ui:define>
</ui:composition>
